package com.skywolf.chem.usercenter.controller;

import com.skywolf.chem.common.sysconfig.response.RespData;
import com.skywolf.chem.usercenter.pojo.param.LoginParam;
import com.skywolf.chem.usercenter.service.IAuthenticationService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName LoginController.java
 * @Author Leo
 * @Version 1.0.0
 * @Description 用户登录 前端控制器
 * @CreateTime 2019年11月30日 21:42:00
 */
@Slf4j
@RequestMapping("/usercenter")
@RestController
@Api(value = "管理后台登录API", description = "管理后台登录API")
public class LoginManagerController {

    @Autowired
    private IAuthenticationService authenticationService;

    @PostMapping("/login")
    public RespData<String> login(@RequestBody LoginParam loginParam) {
        //登录获取token
        String token = authenticationService.login(loginParam);
        return RespData.success(token);
    }
}
